bitkeeper revision 1.1510 (4291adbf-g-WMA-w33q-SnHuwoX3BA)
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Mon, 23 May 2005 10:17:35 +0000 (10:17 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Mon, 23 May 2005 10:17:35 +0000 (10:17 +0000)
XendDomain.py, xc_linux_save.c:
  Re-arrange layout of save/restore file.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
tools/libxc/xc_linux_save.c
tools/python/xen/xend/XendDomain.py

index 7c7415e831098c62cd8db0ee77927bd05d1d47c0..8273f9c56c62cc93ab313ed8b80e72c733c151d3 100644 (file)
@@ -638,9 +638,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
 
     /* Start writing out the saved-domain record. */
 
-    if ( xcio_write(ioctxt, "LinuxGuestRecord",    16) ||
-         xcio_write(ioctxt, &nr_pfns,              sizeof(unsigned long)) ||
-         xcio_write(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ){
+    if ( xcio_write(ioctxt, "LinuxGuestRecord",    16) ){
         xcio_error(ioctxt, "Error writing header");
         goto out;
     }
@@ -648,6 +646,11 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
         xcio_error(ioctxt, "Error writing vmconfig");
         goto out;
     }
+    if ( xcio_write(ioctxt, &nr_pfns,              sizeof(unsigned long)) ||
+         xcio_write(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ){
+        xcio_error(ioctxt, "Error writing header");
+        goto out;
+    }
 
     print_stats( xc_handle, domid, 0, &stats, 0 );
 
index 91ae01f85adfc91274fb7c7731b81dee72a0daf4..8f2a03b14ff0cb2d7464eb07ab8704d889968243 100644 (file)
@@ -342,16 +342,6 @@ class XendDomain:
                 raise XendError("not a valid guest state file: found '%s'" %
                                 signature)
 
-            l = fd.read_exact(sizeof_unsigned_long,
-                              "not a valid guest state file: pfn count read")
-            nr_pfns = unpack("=L", l)[0]   # XXX endianess
-            if nr_pfns > 1024*1024:     # XXX
-                raise XendError(
-                    "not a valid guest state file: pfn count out of range")
-
-            pfn_to_mfn_frame_list = fd.read_exact(PAGE_SIZE,
-                "not a valid guest state file: pfn_to_mfn_frame_list read")
-
             l = fd.read_exact(sizeof_int,
                               "not a valid guest state file: config size read")
             vmconfig_size = unpack("i", l)[0] # XXX endianess
@@ -366,6 +356,16 @@ class XendDomain:
             vmconfig = p.get_val()
             dominfo = self.domain_configure(vmconfig)
 
+            l = fd.read_exact(sizeof_unsigned_long,
+                              "not a valid guest state file: pfn count read")
+            nr_pfns = unpack("=L", l)[0]   # XXX endianess
+            if nr_pfns > 1024*1024:     # XXX
+                raise XendError(
+                    "not a valid guest state file: pfn count out of range")
+
+            pfn_to_mfn_frame_list = fd.read_exact(PAGE_SIZE,
+                "not a valid guest state file: pfn_to_mfn_frame_list read")
+
             # XXXcl hack: fd.tell will sync up the object and
             #             underlying file descriptor
             ignore = fd.tell()